package com.intercept;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.Pointcut;
import org.springframework.aop.support.AbstractGenericPointcutAdvisor;

public class UmpPointcutAdvisor extends AbstractGenericPointcutAdvisor {
    private static final long serialVersionUID = 648438542607932238L;
    public final Pointcut pointcut;
    //这个是我们自己实现的继承于Advice，
    MyAdvice advice = new MyAdvice();

    public UmpPointcutAdvisor() {
        this.pointcut = new UmpMethodPointcut();
    }


    public Pointcut getPointcut() {
        return pointcut;
    }

    @Override
    public Advice getAdvice() {
        return advice;
    }

    //简单起见，就直接使用MethodInterceptor
    class MyAdvice implements MethodInterceptor {

        @Override
        public Object invoke(MethodInvocation invocation) throws Throwable {
            System.out.println("haha11111111111111111111");
            //此处可对自己自定义的注解进行处理！！！
            return invocation.proceed();
        }
    }

}
